/*
 * Author: vyouzhi <vyouzhi@163.com>
 * http://www.xda.cn
 *
 * File: status_lib.h
 * Create Date: 2012-02-01 15:36:59
 *
 */
#ifndef STATUS_LIB_H_
#define STATUS_LIB_H_

#include <pthread.h>
#include <malloc.h>
#include <stdio.h>
#include <openssl/md5.h>
#include <string.h>

#include "dict_lib.h"
#include "time_lib.h"
#include "json_lib.h"
#include "mysql_lib.h"

typedef struct sta_value STA_VALUE;
struct sta_value{
    DICT_LINK *sta_base_link;
    DICT_LINK *sta_explain_link;
};

typedef struct sta_object STA_OBJECT;
struct sta_object{
    STA_VALUE *sv;
    STA_OBJECT *next; 
};

STA_OBJECT *status_object_head;
FieldName *status_fn_head;
pthread_mutex_t sta_lock;

void status_init_all(void);
STA_VALUE *status_value_init(void);
void Get_FieldName(void);
void FieldName_free(FieldName *fn_head);
STA_OBJECT *sta_Find_Object(STA_OBJECT *object_head, char *mdsql);
unsigned int object_length(STA_OBJECT *object_head);
STA_OBJECT *object_init(void);
void object_free_all(STA_OBJECT *object_head);
void object_free(STA_OBJECT *object_link);
void object_reject_end(STA_OBJECT *object_head);
void sta_add_base_link(char *sql, double took);
char *sta_get_link(void);
int to_md5(unsigned char *source, char **target);

#endif /* STATUS_LIB_H_ */
/* vim: set ts=4 sw=4: */

